<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>北极星 - 后台管理系统</title>
    <style>
        /* 基础样式 */
        :root {
            --primary-color: #3498db;
            --secondary-color: #2c3e50;
            --danger-color: #e74c3c;
            --success-color: #2ecc71;
            --light-color: #ecf0f1;
            --dark-color: #34495e;
            --sidebar-width: 250px;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

        body {
            background-color: #f5f7fa;
            color: #333;
            line-height: 1.6;
        }

        /* 布局 */
        .admin-container {
            display: flex;
            min-height: 100vh;
        }

        /* 侧边栏 */
        .sidebar {
            width: var(--sidebar-width);
            background-color: var(--secondary-color);
            color: white;
            position: fixed;
            height: 100vh;
            transition: all 0.3s;
            z-index: 1000;
        }

        .sidebar-header {
            padding: 20px;
            background-color: rgba(0, 0, 0, 0.2);
            text-align: center;
        }

        .sidebar-menu {
            padding: 20px 0;
        }

        .sidebar-menu ul {
            list-style: none;
        }

        .sidebar-menu li a {
            display: block;
            padding: 15px 20px;
            color: white;
            text-decoration: none;
            transition: all 0.3s;
            border-left: 3px solid transparent;
        }

        .sidebar-menu li a:hover,
        .sidebar-menu li a.active {
            background-color: rgba(0, 0, 0, 0.2);
            border-left: 3px solid var(--primary-color);
        }

        .sidebar-menu li a i {
            margin-right: 10px;
            width: 20px;
            text-align: center;
        }

        /* 主内容区 */
        .main-content {
            flex: 1;
            margin-left: var(--sidebar-width);
            padding: 20px;
            transition: all 0.3s;
        }

        /* 顶部导航 */
        .top-nav {
            display: flex;
            justify-content: space-between;
            align-items: center;
            background-color: white;
            padding: 15px 20px;
            border-radius: 5px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
            margin-bottom: 20px;
        }

        .user-info {
            display: flex;
            align-items: center;
        }

        .user-info img {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            margin-right: 10px;
        }

        /* 卡片样式 */
        .card {
            background-color: white;
            border-radius: 5px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
            margin-bottom: 20px;
            overflow: hidden;
        }

        .card-header {
            padding: 15px 20px;
            border-bottom: 1px solid #eee;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .card-body {
            padding: 20px;
        }

        /* 表格样式 */
        .table {
            width: 100%;
            border-collapse: collapse;
        }

        .table th, .table td {
            padding: 12px 15px;
            text-align: left;
            border-bottom: 1px solid #eee;
        }

        .table th {
            background-color: #f8f9fa;
            font-weight: 600;
        }

        .table tr:hover {
            background-color: #f8f9fa;
        }

        /* 按钮样式 */
        .btn {
            display: inline-block;
            padding: 8px 15px;
            border-radius: 4px;
            border: none;
            cursor: pointer;
            font-size: 14px;
            transition: all 0.3s;
        }

        .btn-primary {
            background-color: var(--primary-color);
            color: white;
        }

        .btn-danger {
            background-color: var(--danger-color);
            color: white;
        }

        .btn-success {
            background-color: var(--success-color);
            color: white;
        }

        .btn-sm {
            padding: 5px 10px;
            font-size: 12px;
        }

        .btn:hover {
            opacity: 0.9;
            transform: translateY(-2px);
        }

        /* 表单样式 */
        .form-group {
            margin-bottom: 15px;
        }

        .form-group label {
            display: block;
            margin-bottom: 5px;
            font-weight: 500;
        }

        .form-control {
            width: 100%;
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 4px;
            font-size: 14px;
        }

        textarea.form-control {
            min-height: 120px;
        }

        /* 统计卡片 */
        .stats-cards {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 20px;
            margin-bottom: 20px;
        }

        .stats-card {
            background-color: white;
            border-radius: 5px;
            padding: 20px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
            text-align: center;
        }

        .stats-card h3 {
            font-size: 24px;
            margin-bottom: 10px;
            color: var(--secondary-color);
        }

        .stats-card p {
            color: #7f8c8d;
        }

        /* iframe样式 */
        .content-iframe {
            width: 100%;
            height: calc(100vh - 100px);
            border: none;
            background-color: #f5f7fa;
        }

        .dashboard-content {
            display: block;
        }

        .iframe-content {
            display: none;
        }

        /* 响应式设计 */
        @media (max-width: 768px) {
            .sidebar {
                width: 0;
                overflow: hidden;
            }

            .sidebar.active {
                width: var(--sidebar-width);
            }

            .main-content {
                margin-left: 0;
            }

            .stats-cards {
                grid-template-columns: 1fr;
            }
        }
    </style>
    <!-- 引入Font Awesome图标 -->
    <!--<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">-->
    <link rel="stylesheet" href="../../fontawesome-free-6.7.2-web/css/all.min.css">
</head>
<body>
<div class="admin-container">
    <!-- 侧边栏 -->
    <div class="sidebar" id="sidebar">
        <div class="sidebar-header">
            <h2>北极星后台</h2>
        </div>
        <div class="sidebar-menu">
            <ul>
                <li><a href="dashboard.html" class="active" data-target="dashboard"><i class="fas fa-tachometer-alt"></i> 仪表盘</a></li>
                <li><a href="projects.html" data-target="projects"><i class="fas fa-briefcase"></i> 项目管理</a></li>
                <li><a href="portfolio.html" data-target="portfolio"><i class="fas fa-image"></i> 作品集管理</a></li>
                <li><a href="services.html" data-target="services"><i class="fas fa-cog"></i> 服务管理</a></li>
                <li><a href="messages.html" data-target="messages"><i class="fas fa-comments"></i> 留言管理</a></li>
                <li><a href="profile.html" data-target="profile"><i class="fas fa-user"></i> 个人资料</a></li>
                <li><a href="users.html" data-target="users"><i class="fas fa-users"></i> 用户管理</a></li>
                <li><a href="blog.html" data-target="blog"><i class="fas fa-file-alt"></i> 博客管理</a></li>
                <li><a href="settings.html" data-target="settings"><i class="fas fa-cog"></i> 系统设置</a></li>
                <li><a href="logout.html"><i class="fas fa-sign-out-alt"></i> 退出登录</a></li>
            </ul>
        </div>
    </div>

    <!-- 主内容区 -->
    <div class="main-content">
        <!-- 顶部导航 -->
        <div class="top-nav">
            <div>
                <button class="btn btn-primary" id="toggleSidebar">
                    <i class="fas fa-bars"></i>
                </button>
            </div>
            <div class="user-info">
                <img src="https://via.placeholder.com/40" alt="用户头像">
                <span>北极星</span>
            </div>
        </div>

        <!-- 仪表盘内容 -->
        <div class="dashboard-content" id="dashboard-content">
            <!-- 统计卡片 -->
            <div class="stats-cards">
                <div class="stats-card">
                    <h3>28</h3>
                    <p>进行中项目</p>
                </div>
                <div class="stats-card">
                    <h3>52</h3>
                    <p>已完成项目</p>
                </div>
                <div class="stats-card">
                    <h3>12</h3>
                    <p>待处理留言</p>
                </div>
                <div class="stats-card">
                    <h3>3.2K</h3>
                    <p>本月访问量</p>
                </div>
            </div>

            <!-- 最近项目 -->
            <div class="card">
                <div class="card-header">
                    <h3>最近项目</h3>
                    <a href="#" class="btn btn-primary btn-sm">查看全部</a>
                </div>
                <div class="card-body">
                    <table class="table">
                        <thead>
                        <tr>
                            <th>项目名称</th>
                            <th>客户</th>
                            <th>状态</th>
                            <th>截止日期</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <td>电商平台开发</td>
                            <td>ABC公司</td>
                            <td><span class="badge" style="background-color: var(--primary-color); color: white; padding: 3px 8px; border-radius: 3px;">进行中</span></td>
                            <td>2023-12-15</td>
                            <td>
                                <button class="btn btn-primary btn-sm">编辑</button>
                                <button class="btn btn-danger btn-sm">删除</button>
                            </td>
                        </tr>
                        <tr>
                            <td>企业官网改版</td>
                            <td>XYZ集团</td>
                            <td><span class="badge" style="background-color: var(--success-color); color: white; padding: 3px 8px; border-radius: 3px;">已完成</span></td>
                            <td>2023-11-30</td>
                            <td>
                                <button class="btn btn-primary btn-sm">编辑</button>
                                <button class="btn btn-danger btn-sm">删除</button>
                            </td>
                        </tr>
                        <tr>
                            <td>移动应用开发</td>
                            <td>个人客户</td>
                            <td><span class="badge" style="background-color: var(--primary-color); color: white; padding: 3px 8px; border-radius: 3px;">进行中</span></td>
                            <td>2024-01-20</td>
                            <td>
                                <button class="btn btn-primary btn-sm">编辑</button>
                                <button class="btn btn-danger btn-sm">删除</button>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>

            <!-- 最近留言 -->
            <div class="card">
                <div class="card-header">
                    <h3>最近留言</h3>
                    <a href="#" class="btn btn-primary btn-sm">查看全部</a>
                </div>
                <div class="card-body">
                    <table class="table">
                        <thead>
                        <tr>
                            <th>姓名</th>
                            <th>邮箱</th>
                            <th>留言内容</th>
                            <th>时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <td>李四</td>
                            <td>lisi@example.com</td>
                            <td>关于网站开发咨询...</td>
                            <td>2023-12-05 14:30</td>
                            <td>
                                <button class="btn btn-primary btn-sm">回复</button>
                                <button class="btn btn-danger btn-sm">删除</button>
                            </td>
                        </tr>
                        <tr>
                            <td>王五</td>
                            <td>wangwu@example.com</td>
                            <td>移动应用开发需求...</td>
                            <td>2023-12-04 09:15</td>
                            <td>
                                <button class="btn btn-primary btn-sm">回复</button>
                                <button class="btn btn-danger btn-sm">删除</button>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>

            <!-- 添加新项目表单 -->
            <div class="card">
                <div class="card-header">
                    <h3>添加新项目</h3>
                </div>
                <div class="card-body">
                    <form>
                        <div class="form-group">
                            <label for="projectName">项目名称</label>
                            <input type="text" id="projectName" class="form-control" required>
                        </div>
                        <div class="form-group">
                            <label for="client">客户</label>
                            <input type="text" id="client" class="form-control" required>
                        </div>
                        <div class="form-group">
                            <label for="description">项目描述</label>
                            <textarea id="description" class="form-control" required></textarea>
                        </div>
                        <div class="form-group">
                            <label for="deadline">截止日期</label>
                            <input type="date" id="deadline" class="form-control" required>
                        </div>
                        <div class="form-group">
                            <label for="status">状态</label>
                            <select id="status" class="form-control" required>
                                <option value="pending">待开始</option>
                                <option value="in-progress">进行中</option>
                                <option value="completed">已完成</option>
                            </select>
                        </div>
                        <button type="submit" class="btn btn-primary">添加项目</button>
                    </form>
                </div>
            </div>
        </div>

        <!-- iframe内容区 -->
        <div class="iframe-content" id="iframe-content">
            <iframe id="contentFrame" class="content-iframe" src="about:blank"></iframe>
        </div>
    </div>
</div>

<script>
    // 切换侧边栏显示/隐藏
    document.getElementById('toggleSidebar').addEventListener('click', function() {
        document.getElementById('sidebar').classList.toggle('active');
    });

    // 处理菜单点击事件
    document.querySelectorAll('.sidebar-menu a').forEach(link => {
        link.addEventListener('click', function(e) {
            // 排除退出登录链接
            if (this.getAttribute('href') === 'logout.html') {
                return true;
            }

            e.preventDefault();

            // 获取目标页面
            const target = this.getAttribute('data-target');
            const url = this.getAttribute('href');

            // 如果是仪表盘，显示本地内容
            if (target === 'dashboard') {
                document.getElementById('dashboard-content').style.display = 'block';
                document.getElementById('iframe-content').style.display = 'none';

                // 更新活动菜单项
                updateActiveMenuItem(this);
            } else if (url && url !== '#') {
                // 其他菜单项，在iframe中加载
                document.getElementById('dashboard-content').style.display = 'none';
                document.getElementById('iframe-content').style.display = 'block';

                // 加载iframe内容
                document.getElementById('contentFrame').src = url;

                // 更新活动菜单项
                updateActiveMenuItem(this);
            }
        });
    });

    // 更新活动菜单项
    function updateActiveMenuItem(clickedItem) {
        document.querySelectorAll('.sidebar-menu a').forEach(item => {
            item.classList.remove('active');
        });
        clickedItem.classList.add('active');
    }
</script>
</body>
</html>